//
//  XDTradeRecordsCell.m
//  xindailianmeng
//
//  Created by 张东 on 2017/2/14.
//  Copyright © 2017年 xindailianmeng.cn. All rights reserved.
//

#import "XDTradeRecordsCell.h"
#import "XDTradeRecordsModel.h"
#import "ZHRTBasicMethod.h"
@interface XDTradeRecordsCell ()
@property (weak, nonatomic) IBOutlet UILabel *typeLb;
@property (weak, nonatomic) IBOutlet UILabel *ctimeLb;
@property (weak, nonatomic) IBOutlet UILabel *moneyLb;
@property (weak, nonatomic) IBOutlet UIButton *wdStatusBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *moneyLbConstraint;

@end

@implementation XDTradeRecordsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self = [[NSBundle mainBundle] loadNibNamed:@"XDTradeRecordsCell" owner:self options:nil].firstObject;
    }
    return self;
}


- (void)setModel:(XDTradeRecordsModel *)model {
    _model = model;
    
    self.typeLb.text = _model.type;
    
    self.ctimeLb.text = _model.ctime;
    
    self.moneyLb.text = [ZHRTBasicMethod ChangeNumberFormat: [NSString stringWithFormat:@"%@%.2f",_model.sign,_model.money]];
    
    if (_model.isNewDB == 2 && _model.typeCode == 7) {
        
        self.wdStatusBtn.hidden = NO;
        
        self.moneyLbConstraint.constant = 8;
        [self.wdStatusBtn setTitle:_model.wdStatus forState:UIControlStateNormal];
        self.wdStatusBtn.tag = _model.wdId;
    } else {
        self.wdStatusBtn.hidden = YES;
        self.moneyLbConstraint.constant = 16;
    
    }
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15);    
}
- (IBAction)wdStatusBtnClick:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(wdStatusBtnPushWithdraw:)]) {
        [self.delegate wdStatusBtnPushWithdraw:sender];
    }
    
}

@end
